<template>
	<view class="look_book">
		<view class="zbook">
			<view class="zbook_img" :style="{backgroundImage:'url('+photo_cdn+'zpupload/20230902/1d941ff6481b2b0ef8.png)'}"></view>
			<view v-if="culture_title" class="zbook_name">{{culture_title}}</view>
			<view v-if="culture_name" class="zbook_people">编者 {{culture_name}}</view>
			<view class="zbook_content">
				<scroll-view class="zbook_scroll" :scroll-x="true">
					<view class="flex">
						<view class="zbook_title" v-for="(item,index) in culture_list" :key="index" @tap="toRead(item)">							
							<view v-if="item.title" class="zbook_text">{{item.title}}</view>
						</view>
					</view>
				</scroll-view>
			</view>
		</view>
	</view>
</template>

<script>
	import {previewBook} from "@/utils/api/zupu.js";
	import config from "@/utils/config.js";
	let {photo_cdn} = config.baseUrl;
	export default{
		data(){
			return{
				photo_cdn,
				book_id:0,
				culture_list:[],
				culture_title:'',
				culture_name:''
			}
		},
		onLoad(option){
			this.book_id = option.book_id?option.book_id:0;
			this.previewBookfun();
		},
		methods:{
			previewBookfun(){
				previewBook({
					book_id:this.book_id
				}).then(res=>{
					if(res.code==1){
						this.culture_list = res.data.info.article_arr;
						this.culture_title = res.data.info.title;
						this.culture_name = res.data.info.upload_name;
					}
				})
			},
			toRead(item){
				uni.navigateTo({
					url:`/pages/zupu/puwen/wen_info/wen_info?article_id=${item.id}`
				})
			}
		}
	}
</script>

<style lang="scss">
	@import "./look_book.scss"
</style>